1 Rmd Settings

2 Contents

covid_on_unemp_benefit_numberのOLSとWLS

3 Read functions/関数の読み込み

source("functions.R")

4 Read data/分析用データの読み込み

df_analysis <- readr::read_csv("output/df_analysis.csv")
## Rows: 1551 Columns: 273
## ─ Column specification ────────────────────────────
## Delimiter: ","
## chr    (4): prefec_kanji, prefecture, prefec, prefec_kanji2
## dbl  (268): id, month, year, suicide_total, suicide_male, suicide_female, su...
## date   (1): date
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

5 Y = total unemployment benefit recipients/男女合計の雇用保険受給者数

6 Y = total unemployment benefit recipients/男女合計の雇用保険受給者数 with covar

7 Y = total unemployment benefit recipients(YOY)/男女合計の雇用保険受給者数(前年同月差)

7.5 WLS, with trends, post-covid-month dummies

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend(dataset = df_analysis, 
                    outcome_var = df_analysis$yoy_unemp_benefit_number_total, 
                    treat_var = df_analysis$job_seeker_total_shock)

#texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3,)

# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "job_seeker_total_shock",
                                 estimation_label = "yoy_total_WLS_trend")

# Event study graph
graph_yoy_total_WLS_trend_onlypost <- event_study_graph(data = df_estimates ,
                                          graph_title = "yoy_total_WLS_trend")

ggplotly(graph_yoy_total_WLS_trend_onlypost)
estimates_yoy_total_WLS_trend_onlypost <- df_estimates #for robustness check

results_yot_total_WLS_trend_onlypost <- estimation_results # for only-post DID table

8 Y = total unemployment benefit recipients(YOY)/男女合計の雇用保険受給者数(前年同月差)with covar

8.5 WLS, with trends, post-covid-month dummies

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend_covar8Xcovid_months(dataset = df_analysis, 
                    outcome_var = df_analysis$yoy_unemp_benefit_number_total, 
                    treat_var = df_analysis$job_seeker_total_shock)

#texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3,)

# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "job_seeker_total_shock",
                                 estimation_label = "yoy_total_WLS_trend")

# Event study graph
graph_yoy_total_WLS_trend_covar_onlypost <- event_study_graph(data = df_estimates ,
                                          graph_title = "yoy_total_WLS_trend")

ggplotly(graph_yoy_total_WLS_trend_covar_onlypost)
estimates_yoy_total_WLS_trend_covar_onlypost <- df_estimates #for robustness check

results_yot_total_WLS_trend_covar_onlypost <- estimation_results # for only-post DID table

9 Y = female unemployment benefit recipients/女性の雇用保険受給者数

10 Y = female unemployment benefit recipients/女性の雇用保険受給者数 with covar

11 Y = female unemployment benefit recipients(YOY)/女性の雇用保険受給者数(前年同月差)

11.5 WLS, with trends, post-covid-month dummies

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend(dataset = df_analysis, 
                    outcome_var = df_analysis$yoy_unemp_benefit_number_female, 
                    treat_var = df_analysis$job_seeker_total_shock)

#texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3,)

# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "job_seeker_total_shock",
                                 estimation_label = "yoy_female_WLS_trend")

# Event study graph
graph_yoy_female_WLS_trend_onlypost <- event_study_graph(data = df_estimates ,
                                          graph_title = "yoy_female_WLS_trend")

ggplotly(graph_yoy_female_WLS_trend_onlypost)
estimates_yoy_female_WLS_trend_onlypost <- df_estimates #for robustness check

results_yot_female_WLS_trend_onlypost <- estimation_results # for only-post DID table

12 Y = female unemployment benefit recipients(YOY)/女性の雇用保険受給者数(前年同月差)with covar

12.5 WLS, with trends, post-covid-month dummies

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend_covar8Xcovid_months(dataset = df_analysis, 
                    outcome_var = df_analysis$yoy_unemp_benefit_number_female, 
                    treat_var = df_analysis$job_seeker_total_shock)

#texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3,)

# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "job_seeker_total_shock",
                                 estimation_label = "yoy_female_WLS_trend")

# Event study graph
graph_yoy_female_WLS_trend_covar_onlypost <- event_study_graph(data = df_estimates ,
                                          graph_title = "yoy_female_WLS_trend")

ggplotly(graph_yoy_female_WLS_trend_covar_onlypost)
estimates_yoy_female_WLS_trend_covar_onlypost <- df_estimates #for robustness check

results_yot_female_WLS_trend_covar_onlypost <- estimation_results # for only-post DID table

13 Y = male unemployment benefit recipients/男性の雇用保険受給者数

14 Y = male unemployment benefit recipients/男性の雇用保険受給者数 with covar

15 Y = male unemployment benefit recipients(YOY)/男性の雇用保険受給者数(前年同月差)

15.5 WLS, with trends, post-covid-month dummies

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend(dataset = df_analysis, 
                    outcome_var = df_analysis$yoy_unemp_benefit_number_male, 
                    treat_var = df_analysis$job_seeker_total_shock)

#texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3,)

# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "job_seeker_total_shock",
                                 estimation_label = "yoy_male_WLS_trend")

# Event study graph
graph_yoy_male_WLS_trend_onlypost <- event_study_graph(data = df_estimates ,
                                          graph_title = "yoy_male_WLS_trend")

ggplotly(graph_yoy_male_WLS_trend_onlypost)
estimates_yoy_male_WLS_trend_onlypost <- df_estimates #for robustness check

results_yot_male_WLS_trend_onlypost <- estimation_results # for only-post DID table

16 Y = male unemployment benefit recipients(YOY)/男性の雇用保険受給者数(前年同月差)with covar

16.5 WLS, with trends, post-covid-month dummies

# DID estimation
estimation_results <- dynamic_onlypost_DID_WLS_trend_covar8Xcovid_months(dataset = df_analysis, 
                    outcome_var = df_analysis$yoy_unemp_benefit_number_male, 
                    treat_var = df_analysis$job_seeker_total_shock)

#texreg::screenreg(l = estimation_results , include.ci = FALSE, digits=3,)

# DID estimates and 90% CI
df_estimates <- DID_coefficients_main(DID_results = estimation_results, 
                                         treat_var = "job_seeker_total_shock",
                                 estimation_label = "yoy_male_WLS_trend")

# Event study graph
graph_yoy_male_WLS_trend_covar_onlypost <- event_study_graph(data = df_estimates ,
                                          graph_title = "yoy_male_WLS_trend")

ggplotly(graph_yoy_male_WLS_trend_covar_onlypost)
estimates_yoy_male_WLS_trend_covar_onlypost <- df_estimates #for robustness check

results_yot_male_WLS_trend_covar_onlypost <- estimation_results # for only-post DID table

17 Merge outcome results/アウトカム結果の結合

17.1 Y = total unemployment benefit recipients/男女合計の雇用保険受給者数

#merge and label estimates data
estimates_total_bind <- dplyr::bind_rows(estimates_total_OLS_notrend, 
                                         estimates_total_WLS_notrend, 
                                         estimates_total_OLS_trend,
                                         estimates_total_WLS_trend)

#change labels and reorder labels
estimates_total_bind <- estimates_labeling_main(estimates_total_bind)

# Display results
DT::datatable(estimates_total_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_total_bind <- event_study_graph_bind_main(data = estimates_total_bind, 
                                             graph_title = "Total")

ggplotly(graph_total_bind)

17.2 Y = total unemployment benefit recipients/男女合計の雇用保険受給者数 with covar

#merge and label estimates data
estimates_total_bind <- dplyr::bind_rows(estimates_total_OLS_notrend_covar, 
                                         estimates_total_WLS_notrend_covar, 
                                         estimates_total_OLS_trend_covar,
                                         estimates_total_WLS_trend_covar)

#change labels and reorder labels
estimates_total_bind <- estimates_labeling_main(estimates_total_bind)

# Display results
DT::datatable(estimates_total_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_total_bind_covar <- event_study_graph_bind_main(data = estimates_total_bind, 
                                             graph_title = "Total, with covar")

ggplotly(graph_total_bind_covar)

17.3 Y = total unemployment benefit(YOY) recipients/男女合計の雇用保険受給者数(対前年同期差)

#merge and label estimates data
estimates_yoy_total_bind <- dplyr::bind_rows(estimates_yoy_total_OLS_notrend, 
                                             estimates_yoy_total_WLS_notrend, 
                                             estimates_yoy_total_OLS_trend,
                                             estimates_yoy_total_WLS_trend)

#change labels and reorder labels
estimates_yoy_total_bind <- estimates_labeling_main(estimates_yoy_total_bind)

# display results
DT::datatable(estimates_yoy_total_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_total_bind <- event_study_graph_bind_main(data = estimates_yoy_total_bind, 
                                             graph_title = "Total, YOY")

ggplotly(graph_yoy_total_bind)

17.4 Y = total unemployment benefit recipients(YOY)/男女合計の雇用保険受給者数(対前年同期差) with covar

#merge and label estimates data
estimates_yoy_total_bind <- dplyr::bind_rows(estimates_yoy_total_OLS_notrend_covar, 
                                             estimates_yoy_total_WLS_notrend_covar, 
                                             estimates_yoy_total_OLS_trend_covar,
                                             estimates_yoy_total_WLS_trend_covar)

#change labels and reorder labels
estimates_yoy_total_bind <- estimates_labeling_main(estimates_yoy_total_bind)

# display results
DT::datatable(estimates_yoy_total_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_total_bind_covar <- event_study_graph_bind_main(data = estimates_yoy_total_bind, 
                                             graph_title = "Total, YOY, with covar")

ggplotly(graph_yoy_total_bind_covar)

17.5 Y = female unemployment benefit recipients/女性の雇用保険受給者数

#merge and label estimates data
estimates_female_bind <- dplyr::bind_rows(estimates_female_OLS_notrend, 
                                          estimates_female_WLS_notrend, 
                                          estimates_female_OLS_trend,
                                          estimates_female_WLS_trend)

#change labels and reorder labels
estimates_female_bind <- estimates_labeling_main(estimates_female_bind)

# display results
DT::datatable(estimates_female_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_female_bind <- event_study_graph_bind_main(data = estimates_female_bind, 
                                             graph_title = "Female")

ggplotly(graph_female_bind)

17.6 Y = female unemployment benefit recipients/女性の雇用保険受給者数 with covar

#merge and label estimates data
estimates_female_bind <- dplyr::bind_rows(estimates_female_OLS_notrend_covar, 
                                          estimates_female_WLS_notrend_covar, 
                                          estimates_female_OLS_trend_covar,
                                          estimates_female_WLS_trend_covar)

#change labels and reorder labels
estimates_female_bind <- estimates_labeling_main(estimates_female_bind)

# display results
DT::datatable(estimates_female_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_female_bind_covar <- event_study_graph_bind_main(data = estimates_female_bind, 
                                             graph_title = "Female, with covar")

ggplotly(graph_female_bind_covar)

17.7 Y = female unemployment benefit recipients(YOY)/女性の雇用保険受給者数(対前年同期差)

#merge and label estimates data
estimates_yoy_female_bind <- dplyr::bind_rows(estimates_yoy_female_OLS_notrend, 
                                              estimates_yoy_female_WLS_notrend, 
                                              estimates_yoy_female_OLS_trend,
                                              estimates_yoy_female_WLS_trend)

#change labels and reorder labels
estimates_yoy_female_bind <- estimates_labeling_main(estimates_yoy_female_bind)


# display results
DT::datatable(estimates_yoy_female_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_female_bind <- event_study_graph_bind_main(data = estimates_yoy_female_bind, 
                                             graph_title = "Female, YOY")

ggplotly(graph_yoy_female_bind)

17.8 Y = female unemployment benefit recipients(YOY)/女性の雇用保険受給者数(対前年同期差) with covar

#merge and label estimates data
estimates_yoy_female_bind <- dplyr::bind_rows(estimates_yoy_female_OLS_notrend_covar, 
                                              estimates_yoy_female_WLS_notrend_covar, 
                                              estimates_yoy_female_OLS_trend_covar,
                                              estimates_yoy_female_WLS_trend_covar)

#change labels and reorder labels
estimates_yoy_female_bind <- estimates_labeling_main(estimates_yoy_female_bind)


# display results
DT::datatable(estimates_yoy_female_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_female_bind_covar <- event_study_graph_bind_main(data = estimates_yoy_female_bind, 
                                             graph_title = "Female, YOY, with covar")

ggplotly(graph_yoy_female_bind_covar)

17.9 Y = male unemployment benefit recipients/男性の雇用保険受給者数

#merge and label estimates data
estimates_male_bind <- dplyr::bind_rows(estimates_male_OLS_notrend, 
                                        estimates_male_WLS_notrend, 
                                        estimates_male_OLS_trend,
                                        estimates_male_WLS_trend)

#change labels and reorder labels
estimates_male_bind <- estimates_labeling_main(estimates_male_bind)


# display results
DT::datatable(estimates_male_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_male_bind <- event_study_graph_bind_main(data = estimates_male_bind, 
                                             graph_title = "Male")

ggplotly(graph_male_bind)

17.10 Y = male unemployment benefit recipients/男性の雇用保険受給者数 with covar

#merge and label estimates data
estimates_male_bind <- dplyr::bind_rows(estimates_male_OLS_notrend_covar, 
                                        estimates_male_WLS_notrend_covar, 
                                        estimates_male_OLS_trend_covar,
                                        estimates_male_WLS_trend_covar)

#change labels and reorder labels
estimates_male_bind <- estimates_labeling_main(estimates_male_bind)


# display results
DT::datatable(estimates_male_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_male_bind_covar <- event_study_graph_bind_main(data = estimates_male_bind, 
                                             graph_title = "Male, with covar")

ggplotly(graph_male_bind_covar)

17.11 Y = male unemployment benefit recipients(YOY)/男性の雇用保険受給者数(対前年同期差)

#merge and label estimates data
estimates_yoy_male_bind <- dplyr::bind_rows(estimates_yoy_male_OLS_notrend, 
                                            estimates_yoy_male_WLS_notrend, 
                                            estimates_yoy_male_OLS_trend,
                                            estimates_yoy_male_WLS_trend)

#change labels and reorder labels
estimates_yoy_male_bind <- estimates_labeling_main(estimates_yoy_male_bind)


# display results
DT::datatable(estimates_yoy_male_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_male_bind <- event_study_graph_bind_main(data = estimates_yoy_male_bind, 
                                             graph_title = "Male, YOY")

ggplotly(graph_yoy_male_bind)

17.12 Y = male unemployment benefit recipients(YOY)/男性の雇用保険受給者数(対前年同期差) with covar

#merge and label estimates data
estimates_yoy_male_bind <- dplyr::bind_rows(estimates_yoy_male_OLS_notrend_covar, 
                                            estimates_yoy_male_WLS_notrend_covar, 
                                            estimates_yoy_male_OLS_trend_covar,
                                            estimates_yoy_male_WLS_trend_covar)

#change labels and reorder labels
estimates_yoy_male_bind <- estimates_labeling_main(estimates_yoy_male_bind)


# display results
DT::datatable(estimates_yoy_male_bind) %>%
   DT::formatRound(columns = c("estimate", "ci_lower", "ci_upper"), digits=3)
#graph
graph_yoy_male_bind_covar <- event_study_graph_bind_main(data = estimates_yoy_male_bind, 
                                             graph_title = "Male, YOY, with covar")

ggplotly(graph_yoy_male_bind_covar)

17.13 GGplotly

#ggplotly
ggplotly(graph_yoy_total_bind)
ggplotly(graph_yoy_total_bind_covar)
ggplotly(graph_yoy_female_bind)
ggplotly(graph_yoy_female_bind_covar)
ggplotly(graph_yoy_male_bind) 
ggplotly(graph_yoy_male_bind_covar)

18 Merge graphs/グラフ統合

18.1 Extract legend/legend取り出し

#Legendの表示
graph_for_legend  <- graph_total_bind +
 theme(legend.position = 'bottom', # Adjust x axis label
       legend.title = element_text(colour = "black", size = 20),
       legend.text = element_text(color = "black", size = 20))
graph_for_legend  

#extract legend
legend_model_types <- ggpubr::get_legend(graph_for_legend)
legend_model_types <- ggpubr::as_ggplot(legend_model_types)
legend_model_types

#2行Legendの表示
graph_for_legend_2row  <- graph_total_bind +
 theme(legend.position = 'bottom', # Adjust x axis label
       legend.title = element_text(colour = "black", size = 20),
       legend.text = element_text(color = "black", size = 20))+
  guides(color = guide_legend(nrow = 2, byrow = TRUE)) #legendを二行に変更 2021Sep7 Waki 
graph_for_legend_2row  

#extract legend
legend_2row_model_types <- ggpubr::get_legend(graph_for_legend_2row)
legend_2row_model_types <- ggpubr::as_ggplot(legend_2row_model_types)
legend_2row_model_types

18.2 Merge/統合

グラフを統合して論文用に保存。 ### graph size

dpi_num <- 100
width_num <- 15
height_num <- 18

18.2.3 Robustness check

ymin <- - 200
ymax <- 300

ymin_num <- - 200
ymax_num  <- 300
interval <- 50

graph_total_bind <- graph_total_bind + 
  labs(title = "(a) Total unemployment benefit recipients") + 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_total_bind_covar <- graph_total_bind_covar + 
  labs(title = "(b) Total unemployment benefit recipients, with covaraites") + 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))


graph_female_bind <- graph_female_bind + 
  labs(title = "(c) Female unemployment benefit recipients")+ 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_female_bind_covar <- graph_female_bind_covar + 
  labs(title = "(d) Female unemployment benefit recipients, with covaraites") + 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_male_bind <- graph_male_bind + 
  labs(title = "(e) Male unemployment benefit recipients")+ 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_male_bind_covar <- graph_male_bind_covar + 
  labs(title = "(f) Male unemployment benefit recipients, with covaraites") + 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph <- (graph_total_bind | graph_total_bind_covar) / 
  (graph_female_bind| graph_female_bind_covar) / 
  (graph_male_bind| graph_male_bind_covar)/
  legend_model_types+
  plot_layout(heights = c(2, 2, 2, 0.5))  #0.3から0.5へ変更 2021Sep7 Waki

graph

#保存

ggsave(file = "output/graph_job_seeker_total_shock_on_UIbenefit_robust.pdf", plot = graph, 
       dpi = dpi_num, width = width_num, height = height_num)     

18.2.4 Robustness check (YOY)

ymin <- - 330
ymax <- 400

ymin_num <- - 300
ymax_num  <- 400
interval <- 100

graph_yoy_total_bind <- graph_yoy_total_bind + 
  labs(title = "(a) Total") + 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_yoy_total_bind_covar <- graph_yoy_total_bind_covar + 
  labs(title = "(b) Total, with covaraites") + 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_yoy_female_bind <- graph_yoy_female_bind + 
  labs(title = "(c) Female") + 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_yoy_female_bind_covar <- graph_yoy_female_bind_covar + 
  labs(title = "(d) Female, with covaraites") + 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_yoy_male_bind <- graph_yoy_male_bind + 
  labs(title = "(e) Male") + 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph_yoy_male_bind_covar <- graph_yoy_male_bind_covar + 
  labs(title = "(f) Male, with covaraites") + 
  scale_y_continuous(limit = c(ymin, ymax), breaks=seq(ymin_num, ymax_num, interval))

graph <- (graph_yoy_total_bind | graph_yoy_total_bind_covar) / 
  (graph_yoy_female_bind| graph_yoy_female_bind_covar) / 
  (graph_yoy_male_bind| graph_yoy_male_bind_covar)/
  legend_model_types +
  plot_layout(heights = c(2, 2, 2, 0.5))  #0.3から0.5へ変更 2021Sep7 Waki

graph

#保存

ggsave(file = "output/graph_job_seeker_total_shock_on_yoy_UIbenefit_robust.pdf", plot = graph, 
       dpi = dpi_num, width = width_num, height = height_num) 

19 Regression table/回帰結果表 without covar

options("modelsummary_format_numeric_latex" = "plain")

# 列の選択 column order

# 男女合計、女性、男性、YOYのみ, monthlyhのみ

rows_MONTH <- tribble(~name, ~"(1)", ~"(2)", ~"(3)", ~"(4)", ~"(5)", ~"(6)", 
"Ref. month", "\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}",  "\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}","\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}")

## results list
table_results_MONTH <- list()
table_results_MONTH[["(1)"]] <- results_yot_total_WLS_trend
table_results_MONTH[["(2)"]] <- results_yot_total_WLS_trend_onlypost
table_results_MONTH[["(3)"]] <- results_yot_female_WLS_trend
table_results_MONTH[["(4)"]] <- results_yot_female_WLS_trend_onlypost
table_results_MONTH[["(5)"]] <- results_yot_male_WLS_trend
table_results_MONTH[["(6)"]] <- results_yot_male_WLS_trend_onlypost

## HTML table
estimates_table_MONTH(df = table_results_MONTH,
                      rows = rows_MONTH,
                      title_words = "UIbenefit",
                      gof = gm,
                      output_style = "html") %>%
    kableExtra::add_header_above(c(" " = 1, "Total" = 2, "Female" = 2, "Male" = 2))

## Latex table
estimates_table_MONTH(df = table_results_MONTH,
                      rows = rows_MONTH,
                      gof = gm,
                      title_words = "DID estimates for suicide rates\\label{tab:DID_unemploy_on_suicide}", 
                      output_style = "latex") %>% 
  kableExtra::add_header_above(c(" " = 1, "Total" = 2, "Female" = 2, "Male" = 2)) %>%
  kableExtra::add_footnote(c("Notes: Robust standard errors are clustered at the prefecture level and the number of clusters (i.e. prefectures) is 47. The treatment variable is the COVID-19-induced employment shock, which is calculated as equation \\eqref{eq:employment_shock}. Estimates are obtained based on equation \\eqref{eq:did_model_ver2} with WLS estimation weighted by prefecture population size."),threeparttable = TRUE, notation = "none",escape = FALSE) %>% 
  kableExtra::column_spec(2:7, width = "1.5cm") %>% 
  kableExtra::save_kable("output/job_seeker_total_shock_on_UIbenefit_robust_tables.tex")

20 Regression table/回帰結果表 with covar

# 列の選択 column order

# 男女合計、女性、男性、YOYのみ, monthlyhのみ

rows_MONTH <- tribble(~name, ~"(1)", ~"(2)", ~"(3)", ~"(4)", ~"(5)", ~"(6)", 
"Ref. month", "\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}",  "\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}","\\footnotesize{Jan.2020}", "\\footnotesize{$\\leq$Jan.2020}")

## results list
table_results_MONTH <- list()
table_results_MONTH[["(1)"]] <- results_yot_total_WLS_trend_covar
table_results_MONTH[["(2)"]] <- results_yot_total_WLS_trend_covar_onlypost
table_results_MONTH[["(3)"]] <- results_yot_female_WLS_trend_covar
table_results_MONTH[["(4)"]] <- results_yot_female_WLS_trend_covar_onlypost
table_results_MONTH[["(5)"]] <- results_yot_male_WLS_trend_covar
table_results_MONTH[["(6)"]] <- results_yot_male_WLS_trend_covar_onlypost

## HTML table
estimates_table_MONTH(df = table_results_MONTH,
                      rows = rows_MONTH,
                      title_words = "UIbenefit",
                      gof = gm,
                      output_style = "html") %>%
    kableExtra::add_header_above(c(" " = 1, "Total" = 2, "Female" = 2, "Male" = 2))

## Latex table
estimates_table_MONTH(df = table_results_MONTH,
                      rows = rows_MONTH,
                      gof = gm,
                      title_words = "DID estimates for suicide rates\\label{tab:DID_unemploy_on_suicide}", 
                      output_style = "latex") %>% 
  kableExtra::add_header_above(c(" " = 1, "Total" = 2, "Female" = 2, "Male" = 2)) %>%
  kableExtra::add_footnote(c("Notes: Robust standard errors are clustered at the prefecture level and the number of clusters (i.e. prefectures) is 47. The treatment variable is the COVID-19-induced employment shock, which is calculated as equation \\eqref{eq:employment_shock}. Estimates are obtained based on equation \\eqref{eq:did_model_ver2} with WLS estimation weighted by prefecture population size."),threeparttable = TRUE, notation = "none",escape = FALSE) %>% 
  kableExtra::column_spec(2:7, width = "1.5cm") %>% 
  kableExtra::save_kable("output/job_seeker_total_shock_on_UIbenefit_robust_covar_tables.tex")